<?php


   class OnlyAction extends Action{
   
       public function index(){
	   
	     
		  
		  $this->buyer=M('buyer')->where('id="%s"',$_GET['id'])->find();
		  
		  
	   
	      $this->re=M('orderinfo')->where('id="%s"',$this->buyer['pid'])->find();
		  
		 
		 
	   
	      $this->display();
	   
	   }
	   
	   
	   
	   public function shezhi(){
	   
	     if(!empty($_POST)){
		    
			$id=$_POST['id'];
			
			$order=M('orderinfo')->where('id="%s"',$id)->find();
		 
		    if(session('openid')!=$order['openid']){
			  
			  $ajax=3;
			
			}else{
			
			   if($_POST['type']==0){
			   
			     $arr['suijistart']=$_POST['suiji'];
				 $arr['type']=0;
			   }else{
			     $arr['type']=1;
			     $arr['gudingmoney']=$_POST['guding'];
			   
			   }
			   
			   $re=M('orderinfo')->where('id="%s"',$id)->save($arr);
			   
			   if($re!==false){
			   
			     $ajax=1;
			   }else{
			   
			     $ajax=2;
			   
			   }
			
			}
		   
		   $this->ajaxReturn($ajax);
		 }
	   
	   }
   
   
   
   
   }